package com.qst.controller;

import com.qst.domain.VipPointsRules;
import com.qst.dto.Result;
import com.qst.service.IVipPointsRulesService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/rules")
public class VipPointsRulesController {

    @Resource
    private IVipPointsRulesService vipPointsRulesService;

    @PostMapping
    public Result addRule(@RequestBody VipPointsRules vipPointsRules) {
        return vipPointsRulesService.saveRule(vipPointsRules);
    }

    @DeleteMapping("/delete/{id}")
    public Result deleteRule(@PathVariable("id") Long id){
        return vipPointsRulesService.deleteRule(id);
    }

    @GetMapping("/{id}")
    public Result getRule(@PathVariable("id") Long id){
        return vipPointsRulesService.getRuleById(id);
    }

    @PutMapping
    public Result updateRule(@RequestBody VipPointsRules vipPointsRules){
        return vipPointsRulesService.updateRule(vipPointsRules);
    }



}
